<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<title>GT pro钱包</title>
		<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
		<link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.min.css">
		<link rel="stylesheet" href="bower_components/font-awesome/css/font-awesome.min.css">
		<link rel="stylesheet" href="bower_components/Ionicons/css/ionicons.min.css">
		<link rel="stylesheet" href="bower_components/datatables.net-bs/css/dataTables.bootstrap.min.css">
		<link rel="stylesheet" href="dist/css/AdminLTE.min.css">
		<link rel="stylesheet" href="dist/css/skins/skin-blue.min.css">
		<link rel="stylesheet" href="css/style.css">
		<link rel="stylesheet" href="css/fr_style.css">
		<link rel="stylesheet" href="css/card.css">
		<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700,300italic,400italic,600italic">

		<link rel="stylesheet" href="bower_components/bootstrap-daterangepicker/daterangepicker.css">
		<link rel="stylesheet" href="bower_components/bootstrap-datepicker/dist/css/bootstrap-datepicker.min.css">
	</head>
	<body class="hold-transition skin-blue sidebar-mini">
		<div class="wrapper">
			<div class="content-wrapper">
				<section class="content-header">
					<ol class="breadcrumb">
						<li>
							<a href="#"><i class="fa fa-dashboard"></i>游戏用户</a>
						</li>
						<li class="active">用户管理</li>
					</ol>
				</section>
				<section class="content">
					<div class="box">
						<div class="box-header with-border">
							用户列表
						</div>
						<div class="box-body">
							<div class="buyu_search_group">
								<div class="row">
									<div class="col-xs-12 col-sm-6 col-lg-3">
										<div class="input-group margin">
											<div class="input-group-btn">
												<button type="button" class="btn btn-default" aria-expanded="false">时间</button>
											</div>
											<!-- /btn-group -->
											<input type="text" class="form-control" id="select_time">
											<div class="input-group-addon clearBtns" onclick="clearRangeTime(this)">x</div>
										</div>
									</div>
									<div class="col-xs-12 col-sm-6 col-lg-3">
										<div class="input-group margin">
											<div class="input-group-btn">
												<button type="button" class="btn btn-default" aria-expanded="false">币种id</button>
											</div>
											<input type="text" class="form-control" id="coin_id">
										</div>
									</div>
									<div class="col-xs-12 col-sm-6 col-lg-3">
										<div class="input-group margin">
											<div class="input-group-btn">
												<button type="button" class="btn btn-default" aria-expanded="false">游戏名</button>
											</div>
											<select type="text" class="form-control game_id" id="game_id"></select>
										</div>
									</div>
									<!--<div class="col-xs-12 col-sm-6 col-lg-3">
										<div class="input-group margin">
											<div class="input-group-btn">
												<button type="button" class="btn btn-default" aria-expanded="false">类型</button>
											</div>
											<select type="text" class="form-control" id="status">
												<option value="">请选择类型</option>
												<option value="1">充值</option>
												<option value="2">提现</option>
											</select>
										</div>
									</div>-->
									<div class="col-xs-12 col-sm-6 col-lg-3">
										<button type="button" class="btn bg-primary margin" onclick="search()"><i class="fa fa-search" ></i>&nbsp;搜索</button>
										<button type="button" class="btn bg-primary margin" onclick="reset()"><i class="fa fa-trash" ></i>&nbsp;重置</button>
									</div>
									<div class="col-xs-12">

										<div class="fixed-table-toolbar margin">
											<div class="bs-bars pull-left">
												<div class="hidden-xs" id="managerTableToolbar" role="group">
													<!--新增、冻结、解冻、拉黑、移除黑名单。充值金币-->
													<button type="button" class="btn btn-primary " onclick="addUser()" id=""><i class="fa fa-plus"></i>&nbsp;新增</button>
												</div>
											</div>
										</div>
									</div>
								</div>
							</div>
						</div>
						<div class="row">
							<div class="col-xs-12">
								<!-- /.box-header -->
								<div class="box-body">
									<table id="example" class="display nowrap table table-bordered table-striped" style="width:100%;">
										<thead>
											<tr>
												<th>用户id</th>
												<th>游戏</th>
												<th>币数量</th>
												<th>游戏币数量</th>
												<th>类型</th>
												<th>时间</th>
											</tr>
										</thead>
										<tbody></tbody>
									</table>
								</div>
							</div>
						</div>
					</div>

				</section>
			</div>
		</div>
		<script src="bower_components/jquery/dist/jquery.min.js"></script>
		<script src="bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
		<script src="bower_components/datatables.net/js/jquery.dataTables.min.js"></script>
		<script src="bower_components/datatables.net-bs/js/dataTables.bootstrap.min.js"></script>

		<script src="bower_components/bootstrap-datepicker/dist/js/bootstrap-datepicker.min.js"></script>
		<script src="bower_components/moment/min/moment.min.js"></script>
		<script src="bower_components/bootstrap-daterangepicker/daterangepicker.js"></script>

		<script src="dist/js/adminlte.min.js"></script>
		<script src="js/argument.js"></script>
		<script src="js/fun.js"></script>
		<script src="js/nav.js"></script>
		<script src="js/pop.js"></script>
		<script type="text/javascript">
			$('#select_time').daterangepicker({
				timePicker: true,
				timePicker24Hour: true,
				autoUpdateInput: false,
				locale: {
					format: "YYYY-MM-DD HH:mm"
				}
			})
			
			$.ajax({
				'type': 'post',
				'url': url + "Back_GameList",
				"headers": {
					"auth-token": localStorage.getItem("wallet_token")
				},
				'contentType': "application/x-www-form-urlencoded",
				data: {
					data: JSON.stringify({
						page_num: 1,
					})
				},
				success: function(res) {
					if(res.status == 1000||res.status == 102) {
						ToLogin(res)
						return false;
					} else if(res.status != 1) {
						alert(res.error);
						return false;
					}
					$.each(res.data.data_list,function(index,item){
						if(index == 0){
							$(".game_id").append('<option value="">全部</option>')
						}
						$(".game_id").append('<option value="'+item.id+'">'+item.name+'</option>')
					})
					
				}
			})
			
			var table = $('#example').DataTable({
				'ordering': false,
				'lengthChange': false,
				'searching': false,
				'info': true,
				"processing": true,
				"serverSide": true,
				'scrollX':true,
				"ajax": {
					"type": 'post',
					"url": url + "Back_ApiCoinHistory",
					"contentType": "application/x-www-form-urlencoded",
					"headers": {
						"auth-token": localStorage.getItem("wallet_token")
					},
					"data": function(d) {
						var dataType ={
							game_id:{type:'string',value:$("#game_id").val()},
							coin_id:{type:'string',value:$("#coin_id").val()},
							start_time:{type:'time',value:$("#select_time").val().substring(0, 16)},
							end_time:{type:'time',value:$("#select_time").val().substring(19, 35)}
						}
						var Json = renderData(dataType);
						Json.page_num = d.start / 10 + 1;
						var data={};
						data.data = JSON.stringify(Json);
						return data;
						
						
					},
					"dataFilter": function(data) {
						var datajson = eval('(' + data + ')');
						if(datajson.status == 1000||datajson.status == 102) {
							ToLogin(datajson)
							return false;
						} else if(datajson.status != 1) {
							alert(datajson.error);
							return false;
						}
						var json = {};
						if(datajson.data == null) {
							json.recordsTotal = 0;
							json.recordsFiltered = 0;
							json.data = [];
							return JSON.stringify(json);
						} else {
							json.recordsTotal = datajson.data.total;
							json.recordsFiltered = datajson.data.total;
							json.data = datajson.data.data_list;
							return JSON.stringify(json);
						}
					}
				},
				"columns": [{
						data: 'user_id'
					},
					{
						data: 'game_name'
					},
					{
						data: null,render:function(data){
							return data.coin_num+'&nbsp;'+data.coin_name
						}
					},
					{
						data: null,render:function(data){
							return data.game_num+'&nbsp;'+data.unit_name
						}
					},
					
					{
						data: null,
						render: function(data) {
							var dataList = {
								1:{name:'充值',color:'info'},
								2:{name:'提现',color:'success'}
							}
							return '<div class="fr_status fr_'+dataList[data.type].color+'">'+dataList[data.type].name+'</div>'

						}
					},
//					{
//						data: 'type'
//					},
					{
						data: 'add_time'
					},
					
//					{
//						data: null,
//						render: function(data) {
//							var freeze = '<button type="button" class="btn btn-primary button-margin" onclick="freeze(this)" id=""><i class="fa fa-warning"></i>&nbsp;冻结</button>',
//								unfreeze = '<button type="button" class="btn btn-primary button-margin" onclick="unFreeze(this)" id=""><i class="fa fa-warning"></i>&nbsp;解冻</button>',
//								blacklist = '<button type="button" class="btn btn-primary button-margin" onclick="toBlack(this)" id=""><i class="fa fa-warning"></i>&nbsp;拉黑</button>',
//								unBlacklist = '<button type="button" class="btn btn-primary button-margin" onclick="cancelBlack(this)"><i class="fa fa-check-circle"></i>&nbsp;解除黑名单</button>',
//								recharge = '<button type="button" class="btn btn-primary button-margin" onclick="goldCoin(this)" id=""><i class="fa fa-user-secret"></i>&nbsp;充值子弹</button>';
//							check = '<button type="button" class="btn btn-primary button-margin" onclick="checkDetails(' + data.Id + ')" id=""><i class="fa fa-search"></i>&nbsp;查看详情</button>';
//
//							//状态 1：正常  2：锁定（禁止游戏）   3：拉黑（禁止登录，游戏）   4：注销
//							var str = "<input type='hidden' value='" + JSON.stringify(data) + "'>"
//							return str;
//						}
//					}
				]
			})
		</script>
	</body>

</html>